// 2025/9/26
// 游游的you

#include <iostream>
using namespace std;

int main() {
    int a, b, c, q;
    cin >> q;
    while(q--)
    {
        cin >> a >> b >> c;
        int you = min(a, min(b, c));
        int oo = max(0, b - you - 1);
        int ans = you * 2 + oo;
        cout << ans << endl;
    }
}
// 64 位输出请用 printf("%lld")